package com.hit.server.api.type;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 在线状态
 *
 * @author kehanjiang
 * @date 2023/09/15
 */
public enum OnlineStatusEnums {
    ON("0", "在线"),
    OFF("1", "离线"),
    ;

    private String code;

    private String desc;

    OnlineStatusEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<String, OnlineStatusEnums> MAP = Stream.of(OnlineStatusEnums.values()).collect(Collectors.toMap(OnlineStatusEnums::getCode, v -> v));

    public static OnlineStatusEnums getByCode(String code) {
        return MAP.get(code);
    }
}
